
/// 状态类
sealed class LogicResult<T> {
  const LogicResult();

  const factory LogicResult.ok(T data) = Ok<T>;

  const factory LogicResult.failed(int code, String msg) = Fail<T>;

}

final class Ok<T> extends LogicResult<T> {
  const Ok(this.data);

  final T data;

  @override
  String toString() => 'Ok<$T>($data)';
}

final class Fail<T> extends LogicResult<T> {
  const Fail(this.code,this.msg);

  final int code;

  final String msg;

  @override
  String toString() => 'Fail code:$code  msg:$msg';
}